package com.ck567.nacostest.controller

import com.ck567.nacostest.entity.Person
import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.Parameter
import org.springframework.web.bind.annotation.*

@RestController
@RequestMapping
class HelloController {

    @PostMapping("/persons")
    @Operation(summary = "这是一个新增用户接口", description = "入参是一个人类对象，反参是一个字符串", tags = ["新增用户接口"])
    fun addPerson(
        @Parameter(description = "用户")
        @RequestBody person: Person
    ): String{
        return "ok"
    }

    @GetMapping("/persons")
    @Operation(summary = "备注", description = "详细描述", tags = ["外层标签"])
    fun findPerson(
        @Parameter(description = "姓名")
        @RequestParam("name")name: String,
        @Parameter(description = "年龄")
        @RequestParam("age")age: Int
    ): Person{
        return Person(age,name)
    }

}
